#ifndef CORE_APPLICATION_HPP
#define CORE_APPLICATION_HPP

#include <QtGui/QApplication>

#include <core/core.hpp>

#include <model/repository.hpp>

namespace model {
    class repository;
    typedef shared_ptr<repository> repository_ptr;
}

namespace core
{

    class application : public QApplication
    {
        Q_OBJECT
    public:
        application(int argc, char** argv);
        virtual ~application();
        virtual void init() = 0;

    public slots:
        virtual void on_create_repository_request(const string& path);
        virtual void on_open_repository_request(const string& path);
        virtual void on_save_repository_as_request(const string& path);
        virtual void on_save_repository_request();
        virtual void on_close_repository_request();

    signals:
        void repository_opened(model::repository_ptr p);
        void repository_saved(model::repository_ptr p);
        void repository_closed();

    private:
        void save_repository();
        void open_repository(const string& path);
        
        model::repository_ptr repos_;
    };
};

#endif
